package mall.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import mall.dao.ProductDAO;
import mall.pojo.Product;

@Service
public class ProductServiceImpl implements ProductService {
	
	@Autowired
	private ProductDAO productDAO;

	@Override
	@Transactional
	public List<Product> getProductShop(int shopId,int catId,int kind) {
		return (List<Product>) productDAO.getProductShop(shopId,catId,kind);
	}

	@Override
	@Transactional
	public List<Product> getListProduct() {
		return (List<Product>) productDAO.getListProduct();
	}

	@Override
	@Transactional
	public Product getProduct(int productId) {
		return productDAO.getProduct(productId);
	}

	@Override
	@Transactional
	public void createProduct(Product product) {
		productDAO.createProduct(product);
	}

	
	@Override
	@Transactional
	public int updateProduct(Product product) {
		return productDAO.updateProduct(product);
	}

	@Override
	@Transactional
	public int deleteProduct(int productId) {
		return productDAO.deleteProduct(productId);
	}
	

}
